<?php 
 
error_reporting(E_ALL|E_STRICT); 
ini_set('display_errors', 1); 
date_default_timezone_set('Europe/London'); 
 
// directory setup and class loading 
set_include_path('.' . PATH_SEPARATOR . '../library/' 
     . PATH_SEPARATOR . '../application/models' 
     . PATH_SEPARATOR . get_include_path()); 
include "Zend/Loader.php"; 
Zend_Loader::registerAutoload(); 

// load configuration
$config = new Zend_Config_Ini('../application/config.ini', 'general');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);

// setup database
$db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);

// setup controller
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->addModuleDirectory('../application/');

// setup role
$auth = Zend_Auth::getInstance();
$acl = new My_Acl($auth);
$frontController->registerPlugin(new My_Controller_Plugin_Acl($auth, $acl));

// setup layout
Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts'));

// run!
$frontController->dispatch();
